ostree.git
9 years agorepo: Drop more internally unused GFile members
Colin Walters [Fri, 5 Aug 2016 11:08:14 +0000 (07:08 -0400)]
repo: Drop more internally unused GFile members

I forgot to actually remove `config_file` in the previous
commit, the txn lock hasn't been used in a long time, and
for the uncompressed cache, everything uses the fd already.

Closes: #433
Approved by: giuseppe

9 years agotravis: run the test suite on various distributions
Simon McVittie [Fri, 5 Aug 2016 21:12:55 +0000 (22:12 +0100)]
travis: run the test suite on various distributions

.travis.yml is obviously still Travis-specific, but tests/ci-* are
designed to be shareable with other CI environments if there is interest
in doing so.

At the moment I'm only testing on Debian and Ubuntu. In principle we
could try a non-Debian-derived Docker container such as Fedora or CentOS
inside travis-ci's Ubuntu environment, similar to what I'm doing
for Debian, but I don't know the correct setup commands to use there.

Closes: #438
Approved by: cgwalters

9 years ago.travis.yml: Delete, we aren't using it right now
Colin Walters [Fri, 5 Aug 2016 20:30:13 +0000 (16:30 -0400)]
.travis.yml: Delete, we aren't using it right now

@smcv will re-add a new version.

Closes: #439
Approved by: smcv

9 years agoSkip tests that use whiteouts under Docker/aufs
Simon McVittie [Fri, 5 Aug 2016 19:41:05 +0000 (20:41 +0100)]
Skip tests that use whiteouts under Docker/aufs

ostree's naming convention for whiteouts is similar to what is
done in aufs, which means we can't compose the trees to test this
feature under Docker with the aufs storage driver, as used on
travis-ci.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #437
Approved by: cgwalters

9 years agoUpdate libglnx: Add missing files to libglnx distribution
Simon McVittie [Fri, 5 Aug 2016 13:38:34 +0000 (14:38 +0100)]
Update libglnx: Add missing files to libglnx distribution

This fixes distcheck.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #436
Approved by: cgwalters

9 years agorepo: Drop internal GFile config_file
Colin Walters [Fri, 5 Aug 2016 01:49:05 +0000 (21:49 -0400)]
repo: Drop internal GFile config_file

The remote parsing code still uses GFiles but this is a start.

Closes: #432
Approved by: giuseppe

9 years agolib: Drop GFiles for self->{objects_dir,state_dir}
Colin Walters [Fri, 5 Aug 2016 01:31:39 +0000 (21:31 -0400)]
lib: Drop GFiles for self->{objects_dir,state_dir}

Everything that used to reference these is now fd-relative.

Closes: #432
Approved by: giuseppe

9 years agorepo: Port metadata writing code to fd-relative
Colin Walters [Fri, 5 Aug 2016 01:30:56 +0000 (21:30 -0400)]
repo: Port metadata writing code to fd-relative

It was the last thing referencing `self->objects_dir`.

Closes: #432
Approved by: giuseppe

9 years agolib: Fix a compiler warning introduced from earlier patch
Colin Walters [Thu, 4 Aug 2016 20:35:49 +0000 (16:35 -0400)]
lib: Fix a compiler warning introduced from earlier patch

I think we'd end up closing stdin...yuck.  Need to investigate
having this be fatal, but CentOS 7 `gcc-4.8.5` doesn't understand
`-Werror=int-conversion`.

Closes: #430
Approved by: giuseppe

9 years agolib: Use libglnx file replace API more consistently
Colin Walters [Thu, 4 Aug 2016 17:29:13 +0000 (13:29 -0400)]
lib: Use libglnx file replace API more consistently

We have a better API now, drop use of the internal helper, which also
depended on libgsystem.

This required bumping libglnx to pull in a fix.

Closes: #429
Approved by: giuseppe

9 years agoUpdate libglnx for O_TMPFILE build time option
Colin Walters [Wed, 3 Aug 2016 17:16:30 +0000 (13:16 -0400)]
Update libglnx for O_TMPFILE build time option

See: https://github.com/ostreedev/ostree/issues/421

Closes: #426
Approved by: gatispaeglis

9 years agolib: Add padding booleans to OstreeRepoCheckoutAtOptions
Colin Walters [Thu, 4 Aug 2016 11:22:41 +0000 (07:22 -0400)]
lib: Add padding booleans to OstreeRepoCheckoutAtOptions

Since this is a new API, and adding booleans is the most likely thing
we'll do, let's stick some explicit padding for them in here now.

We could use the `unused_ints[]` but it'd be out of order, and this
will more clearly remind people about the padding.  The efficiency hit
versus bitfields is annoying, but oh well, not a real world problem.

Closes: #427
Approved by: giuseppe

9 years agorepo: Flip the fsync default to off for new checkout API
Colin Walters [Wed, 3 Aug 2016 14:55:35 +0000 (10:55 -0400)]
repo: Flip the fsync default to off for new checkout API

Since we're adding a new API, we have the opportunity to fix
the defaults.  We expect clients to do a `syncfs()` or equivalent
on their own now, since it's way more efficient.

Flip the checkout fsync default to off.

Closes: #425
Approved by: giuseppe

9 years agodeltas: Port compilation to libglnx/fd-relative
Colin Walters [Tue, 2 Aug 2016 18:49:42 +0000 (14:49 -0400)]
deltas: Port compilation to libglnx/fd-relative

This was the last use of libgsystem tmpfile APIs.  The change here is
a bit uglier than it needs to be because we support creating the delta
in place as well as in the repo, so we needed to abstract over
locations.

Closes: #424
Approved by: giuseppe

9 years agogrub2: Port away from gs_file_sync_data()
Colin Walters [Mon, 1 Aug 2016 01:31:45 +0000 (21:31 -0400)]
grub2: Port away from gs_file_sync_data()

Inlining this is uglier, but this code kind of sucks anyways =( We're
going to need to do some fd-relative porting in here at some point.

Closes: #424
Approved by: giuseppe

9 years agolib: Port away from gs_file_rename()
Colin Walters [Mon, 1 Aug 2016 01:33:15 +0000 (21:33 -0400)]
lib: Port away from gs_file_rename()

In one case, we already had relative fds and hence this was
nicer.  Unfortunately the other areas got uglier.  More fd-relative
porting to do later.

Closes: #424
Approved by: giuseppe

9 years agoostree-prepare-root: Add test that overlayfs over /usr works.
William Manley [Sun, 31 Jul 2016 21:19:13 +0000 (22:19 +0100)]
ostree-prepare-root: Add test that overlayfs over /usr works.

Closes: #403
Approved by: cgwalters

9 years agoostree-prepare-root: Fix typo in error message
William Manley [Tue, 26 Jul 2016 17:05:25 +0000 (18:05 +0100)]
ostree-prepare-root: Fix typo in error message

Closes: #403
Approved by: cgwalters

9 years agoostree-prepare-root: Make error message capitalisation consistent
William Manley [Tue, 26 Jul 2016 16:53:53 +0000 (17:53 +0100)]
ostree-prepare-root: Make error message capitalisation consistent

There seemed to be more lower case first letters so I've standardised
on that.

Closes: #403
Approved by: cgwalters

9 years agoostree-prepare-root: Use pivot_root if real sysroot is already mounted at /
William Manley [Tue, 19 Jul 2016 18:48:23 +0000 (19:48 +0100)]
ostree-prepare-root: Use pivot_root if real sysroot is already mounted at /

This allows ostree-prepare-root outside of the initramfs context where the
real rootfs is already mounted at /.  We can't use `mount --move` in this
case because we would be trying to move / into a subdirectory of itself.

Closes: #403
Approved by: cgwalters

9 years agoRefactor ostree-prepare-root: Perform chdir to deploy directory earlier
William Manley [Mon, 18 Jul 2016 17:09:10 +0000 (18:09 +0100)]
Refactor ostree-prepare-root: Perform chdir to deploy directory earlier

...for simplicity.  This way we don't need to keep concatenating
deploy_path to everything.  We can just refer relative to the current
working directory.

We need to do this after bind-mounting it over itself otherwise our cwd
is still on the non-bind-mounted filesystem below.

Closes: #403
Approved by: cgwalters

9 years agoostree-prepare-root: Refactor: Create /sysroot.tmp much later
William Manley [Mon, 18 Jul 2016 17:02:12 +0000 (18:02 +0100)]
ostree-prepare-root: Refactor: Create /sysroot.tmp much later

Typically we have our ready made-up up root at
`/sysroot/ostree/deploy/.../` (`deploy_path`) and the real rootfs at
`/sysroot` (`root_mountpoint`).  We want to end up with our made-up root
at `/sysroot/` and the real rootfs under `/sysroot/sysroot` as systemd
will be responsible for moving `/sysroot` to `/`.

We need to do this in 3 moves to avoid trying to move `/sysroot` under
itself:

1. `/sysroot/ostree/deploy/...` -> `/sysroot.tmp`
2. `/sysroot` -> `/sysroot.tmp/sysroot`
3. `/sysroot.tmp` -> `/sysroot`

This is a refactoring to group all these operations together so I can
implement an alternative in terms of `pivot_root`.

Closes: #403
Approved by: cgwalters

9 years agoostree-prepare-root: Cope with /proc not being mounted
William Manley [Mon, 18 Jul 2016 16:44:19 +0000 (17:44 +0100)]
ostree-prepare-root: Cope with /proc not being mounted

When trying to read kernel command-line.

Closes: #403
Approved by: cgwalters

9 years agoostree-prepare-root as init: exec init from deployment if run as PID1
William Manley [Mon, 18 Jul 2016 16:03:11 +0000 (17:03 +0100)]
ostree-prepare-root as init: exec init from deployment if run as PID1

This supports running ostree on embedded platforms without an initrd.
Specificially I'm trying to do bringup on an NVidia Tegra based Jetson TK1
dev board.

Closes: #403
Approved by: cgwalters

9 years agoostree-prepare-root: Refactor code to resolve deploy_path
William Manley [Mon, 18 Jul 2016 13:42:40 +0000 (14:42 +0100)]
ostree-prepare-root: Refactor code to resolve deploy_path

I'll reuse this for a new ostree-init.

Closes: #403
Approved by: cgwalters

9 years agotests: Add basic tests for ostree-prepare-root
William Manley [Wed, 27 Jul 2016 15:40:05 +0000 (16:40 +0100)]
tests: Add basic tests for ostree-prepare-root

These tests use unshare and mount to prepare a fake initrd/early boot
directory structure so we can then test ostree-prepare-root.

Things that are tested:

* Running in an initrd environment
* Running without initrd
* /var and /sysroot being mounted correctly
* /usr being mounted read-only

Things not tested (yet):

* Running as init - this could be accomplished by unsharing the pid
  namespace too.
* mounting/unmounting `/proc` if `/proc/cmdline` isn't available
* Persistent overlayfs for `/usr`
* Probably other things

The tests are basic but can be extended in the future as we do more work
on `ostree-prepare-root`.

These tests must be run as root as they require the ability to `mount`
and to `unshare` the mount namespace. Perhaps in the future we can use
user namespaces for this test once they are more widely available.

Closes: #403
Approved by: cgwalters

9 years agorepo: Port to g_autoptr() rather than old style cleanup macros
Colin Walters [Mon, 1 Aug 2016 00:50:07 +0000 (20:50 -0400)]
repo: Port to g_autoptr() rather than old style cleanup macros

This notably kills a few libgsystem uses here.

Closes: #423
Approved by: giuseppe

9 years agorepo: Port sign_data() to libglnx tmpfile APIs
Colin Walters [Mon, 1 Aug 2016 00:58:32 +0000 (20:58 -0400)]
repo: Port sign_data() to libglnx tmpfile APIs

Part of dropping libgsystem.

Closes: #423
Approved by: giuseppe

9 years agodeploy: Replace a use of gs_file_enumerator with compat wrapper
Colin Walters [Mon, 1 Aug 2016 01:03:16 +0000 (21:03 -0400)]
deploy: Replace a use of gs_file_enumerator with compat wrapper

More libglnx/glib porting.

Closes: #423
Approved by: giuseppe

9 years agorepo: Make ostree_repo_create() nonfatal on existing repos
Colin Walters [Mon, 1 Aug 2016 14:43:49 +0000 (10:43 -0400)]
repo: Make ostree_repo_create() nonfatal on existing repos

In general we want to support "idempotentcy" or "state
synchronization" across interruption.  If a repo is only partially
created due to a crash or whatever, it's hard for a user to know that.
Let's just make `ostree_repo_create()` idempotent. Since all we're
doing is a set of `mkdirat()` invocations, it's quite simple.

This also involved porting to fd-relative, which IMO makes the
code a lot clearer.

Closes: #422
Approved by: 14rcole

9 years agotests: Add test for delta with empty parts
Dan Nicholson [Sat, 30 Jul 2016 16:00:04 +0000 (09:00 -0700)]
tests: Add test for delta with empty parts

Closes: #420
Approved by: cgwalters

9 years agodeltas: Allow processing of empty delta parts
Dan Nicholson [Sat, 30 Jul 2016 15:14:17 +0000 (10:14 -0500)]
deltas: Allow processing of empty delta parts

If a static delta is generated between 2 commits with the same content,
then the delta will contain 1 part with no checksums. While useless,
this is a valid delta that shouldn't raise an assertion. If the delta
part has no checksums, then there are no objects to recreate and the
processing can be skipped.

Closes: #420
Approved by: cgwalters

9 years agolibostree, ostree: fix usage of ostree_repo_checkout_tree_at
Giuseppe Scrivano [Wed, 27 Jul 2016 09:34:22 +0000 (11:34 +0200)]
libostree, ostree: fix usage of ostree_repo_checkout_tree_at

it was deprecated, use ostree_repo_checkout_at.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #417
Approved by: cgwalters

9 years agolibostree: skip introspection for two functions
Giuseppe Scrivano [Fri, 29 Jul 2016 14:03:11 +0000 (16:03 +0200)]
libostree: skip introspection for two functions

These two functions are not safe for gobject introspection, so annotate
them to be skipped:

1) ostree_repo_import_archive_to_mtree
2) ostree_repo_export_tree_to_archive

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #417
Approved by: cgwalters

9 years agolibostree: mark ostree_repo_checkout_tree_at as deprecated
Giuseppe Scrivano [Wed, 27 Jul 2016 09:11:13 +0000 (11:11 +0200)]
libostree: mark ostree_repo_checkout_tree_at as deprecated

and move its definition to a separate file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #417
Approved by: cgwalters

9 years agolibostree: new function ostree_repo_checkout_at
Giuseppe Scrivano [Wed, 27 Jul 2016 08:38:36 +0000 (10:38 +0200)]
libostree: new function ostree_repo_checkout_at

Provide a gobject introspection safe version for
`ostree_repo_checkout_tree_at'.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #417
Approved by: cgwalters

9 years agolibglnx porting: Migrate to new tempfile code
Colin Walters [Mon, 27 Jun 2016 01:59:12 +0000 (21:59 -0400)]
libglnx porting: Migrate to new tempfile code

In general this is even cleaner now, though it was better after I
extracted a helper function for the "write tempfile with contents"
bits that were shared between metadata and regular file codepaths.

Closes: #369
Approved by: jlebon

9 years agostatic-delta: remove unused struct
Jonathan Lebon [Fri, 29 Jul 2016 16:31:42 +0000 (12:31 -0400)]
static-delta: remove unused struct

Closes: #418
Approved by: cgwalters

9 years agostatic-delta: fix command contexts
Jonathan Lebon [Fri, 29 Jul 2016 14:57:44 +0000 (10:57 -0400)]
static-delta: fix command contexts

Closes: #418
Approved by: cgwalters

9 years agodeltas: Handle untrusted checksums faster and more robustly
Colin Walters [Mon, 11 Jul 2016 13:29:18 +0000 (09:29 -0400)]
deltas: Handle untrusted checksums faster and more robustly

When reworking the ostree core [to use O_TMPFILE](https://github.com/ostreedev/ostree/pull/369),
I hit an issue in the way the untrusted delta codepath ends up trying
to re-open the file to checksum it.  That's not possible with
`O_TMPFILE` since the fd (which we opened `O_WRONLY`) is the only
accessible reference to the content.

Fix this by changing the delta processing code to update a checksum as
we're doing writes, which is also faster, and ends up simplifying the
code as well.

What would be an even larger simplification here is if we e.g. used a
separate thread calling `write_object()` or something like that; the
main issue I see there is somehow bridging the fact that function
wants a `GInputStream*` but the delta code is generating stream of
writes.

Closes: #392
Approved by: jlebon

9 years agotests/delta-crosscheck: Add missing --from
Colin Walters [Fri, 29 Jul 2016 01:06:38 +0000 (21:06 -0400)]
tests/delta-crosscheck: Add missing --from

Otherwise we generate a static delta from the *previous* and get
confused.  To make doubly sure, add `--require-static-deltas` to pull.

Closes: #416
Approved by: jlebon

9 years agolib: Fix compiler warning from previous patch
Colin Walters [Thu, 28 Jul 2016 13:57:48 +0000 (09:57 -0400)]
lib: Fix compiler warning from previous patch

I had this in a `fixup!` I thought.

Closes: #414
Approved by: giuseppe

9 years agolib: Fix leak in bootconfig parser
Colin Walters [Sun, 24 Jul 2016 19:45:02 +0000 (15:45 -0400)]
lib: Fix leak in bootconfig parser

Pretty simple.

Closes: #410
Approved by: giuseppe

9 years agodeploy: Fix leaks in parsing /etc/os-release
Colin Walters [Sun, 24 Jul 2016 19:40:49 +0000 (15:40 -0400)]
deploy: Fix leaks in parsing /etc/os-release

This one is a bit subtle; we're generating a hash that contains
pointers to the strings we parsed, so we need to carefully track
ownership.

Closes: #410
Approved by: giuseppe

9 years agosysroot: Fix a leak in deployment dirpath API
Colin Walters [Sun, 24 Jul 2016 19:40:22 +0000 (15:40 -0400)]
sysroot: Fix a leak in deployment dirpath API

This one is pretty obvious in retrospect.

Closes: #410
Approved by: giuseppe

9 years agoglib.supp: Suppress g_task -> thread leaks
Colin Walters [Sun, 24 Jul 2016 19:26:11 +0000 (15:26 -0400)]
glib.supp: Suppress g_task -> thread leaks

There are variants of this, but right now because `GTask` has its
own pool which isn't necessarily cleaned up on exit, we need
to suppress all of this.

Closes: #410
Approved by: giuseppe

9 years agofetcher: Explicitly join thread if it's not self
Colin Walters [Sun, 24 Jul 2016 19:11:17 +0000 (15:11 -0400)]
fetcher: Explicitly join thread if it's not self

This fixes a valgrind leak; see [this StackOverflow thread](http://stackoverflow.com/questions/17642433/why-pthread-causes-a-memory-leak).

Closes: #410
Approved by: giuseppe

9 years agoglib.supp: Suppress worker context -> thread bits
Colin Walters [Sun, 24 Jul 2016 19:10:55 +0000 (15:10 -0400)]
glib.supp: Suppress worker context -> thread bits

The worker context isn't cleaned up now.

Closes: #410
Approved by: giuseppe

9 years agopull-local: Explicitly unref variant rather than relying on floating
Colin Walters [Sun, 24 Jul 2016 19:00:02 +0000 (15:00 -0400)]
pull-local: Explicitly unref variant rather than relying on floating

This shows up as a leak in valgrind; the callee isn't sinking.  In
general through the power of cleanup attributes we can do explicit
cleanup rather than relying on floating refs.

Closes: #410
Approved by: giuseppe

9 years agoglib.supp: Suppress some dynamic type registrations too
Colin Walters [Sun, 24 Jul 2016 18:59:33 +0000 (14:59 -0400)]
glib.supp: Suppress some dynamic type registrations too

These mirror the static ones, and we need the dynamic versions for
glib-networking -> gnutls stuff.

Closes: #410
Approved by: giuseppe

9 years agotrivial-httpd: Fix leak of option context
Colin Walters [Sun, 24 Jul 2016 18:54:07 +0000 (14:54 -0400)]
trivial-httpd: Fix leak of option context

Right now our valgrind runs also end up valgrinding the
`trivial-httpd` code, so while it doesn't matter, let's fix this leak
anyways.  We need to avoid calling `_exit()` since that won't run the
cleanup functions.

Closes: #410
Approved by: giuseppe

9 years agopull: Don't execute static deltas when mirroring
Colin Walters [Fri, 22 Jul 2016 20:58:26 +0000 (16:58 -0400)]
pull: Don't execute static deltas when mirroring

We don't presently support this, since the static delta code assumes
it can just `mmap()` file objects.  We could at some point implement
this, but for now just skip executing deltas when doing
`archive -> archive` mirroring.

I noticed this when trying to mirror a repo in Jenkins in
[CAHC](https://wiki.centos.org/SpecialInterestGroup/Atomic/Devel).

Closes: #408
Approved by: giuseppe

9 years agorepo: Fix leak with ostree_repo_commit_traverse_iter_init_commit()
Colin Walters [Fri, 8 Jul 2016 15:26:45 +0000 (11:26 -0400)]
repo: Fix leak with ostree_repo_commit_traverse_iter_init_commit()

I noticed this using `OT_TEST_VALGRIND=1` on `test-basic.sh`.

Closes: #385
Approved by: jlebon

9 years agolibglnx: bump to latest
Jonathan Lebon [Fri, 22 Jul 2016 13:34:32 +0000 (09:34 -0400)]
libglnx: bump to latest

OSTree can sometimes print very long lines which lead to many empty
spaces getting printed if the output overflowed the line due to a bug in
libglnx.

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Closes: #406
Approved by: cgwalters

9 years agodocs/formats: Elaborate a bit on delta from NULL usage
Colin Walters [Tue, 19 Jul 2016 14:24:18 +0000 (10:24 -0400)]
docs/formats: Elaborate a bit on delta from NULL usage

See discussion on ostree-list.

Closes: #402
Approved by: gatispaeglis

9 years agobuild: Make symlink depend on source
Colin Walters [Fri, 15 Jul 2016 15:17:43 +0000 (11:17 -0400)]
build: Make symlink depend on source

Closes: https://github.com/ostreedev/ostree/issues/389
Closes: #400
Approved by: smcv

9 years agocore: Add allocating b64 checksum functions
Dan Nicholson [Thu, 14 Jul 2016 16:09:12 +0000 (09:09 -0700)]
core: Add allocating b64 checksum functions

The checksum_b64_inplace variants can't be used in bindings. Provide
versions that allocate and return the output rather than working on a
passed in buffer. These can then be used in GI bindings to get the
ostree modified base64 encodings.

Closes: #398
Approved by: cgwalters

9 years agolib: Fix version script node ordering
Dan Nicholson [Thu, 14 Jul 2016 19:45:39 +0000 (12:45 -0700)]
lib: Fix version script node ordering

The order of the VERSION nodes is such that the new node name goes first
and the one it depends on goes after the commands. See
https://sourceware.org/binutils/docs/ld/VERSION.html.

Closes: #398
Approved by: cgwalters

9 years agoREADME: Fix broken link
Matthew Leeds [Thu, 14 Jul 2016 20:10:55 +0000 (16:10 -0400)]
README: Fix broken link
Closes: #397
Approved by: cgwalters

9 years agoMakefile-tests.am: make check uses the built binaries
Giuseppe Scrivano [Thu, 14 Jul 2016 11:42:32 +0000 (13:42 +0200)]
Makefile-tests.am: make check uses the built binaries

The tests suite was failing locally as it was using the installed
version of rofiles-fuse, instead of the built one.  Create the needed
symlinks in tests/ as we are already doing for the "ostree" binary.

ostree-prepare-root and ostree-remount added for completeness.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #395
Approved by: cgwalters

9 years agobuiltins/commit: Switch to using ostree_repo_write_dfd_to_mtree()
Colin Walters [Wed, 13 Jul 2016 15:46:16 +0000 (11:46 -0400)]
builtins/commit: Switch to using ostree_repo_write_dfd_to_mtree()

Where we're referencing local files.  It's what
ostree_repo_write_directory_to_mtree() is doing internally anyways,
and I consider the `GFile*` based APIs to be generally deprecated for
the most part.

Closes: #394
Approved by: giuseppe

9 years agorepo: Ensure we set mode for bare-user files before xattrs
Colin Walters [Tue, 12 Jul 2016 13:43:32 +0000 (09:43 -0400)]
repo: Ensure we set mode for bare-user files before xattrs

When trying to switch ostree to `O_TMPFILE`, I hit the fact that
by default it uses mode `000`.  It still works to write to the
open fd of course, but it *doesn't* work to set xattrs because
that code path for some reason in the kernel checks the mode bits.

This only broke for bare-user repos where we tried to set the xattr
before calling `fchmod()`, so just invert those two operations.

Closes: #391
Approved by: jlebon

9 years agoRevert "tests/libtest.sh: Print non-matching file on failure"
Colin Walters [Mon, 11 Jul 2016 19:18:34 +0000 (15:18 -0400)]
Revert "tests/libtest.sh: Print non-matching file on failure"

This reverts commit 71301d18244a3a26a6ba6fd3934633ef94811a15.

I was confused by the fact that the non-matching content was
empty and forgot we already did print it.

Reported-by: smcv
Closes: #390
Approved by: jlebon

9 years agotests: Fix karg tests on ostree-booted system
Colin Walters [Fri, 8 Jul 2016 14:54:11 +0000 (10:54 -0400)]
tests: Fix karg tests on ostree-booted system

https://github.com/ostreedev/ostree/pull/372 caused these tests to
start failing when the host system is managed using ostree - since the
tests *do* replace the `ostree=` kernel argument.

Closes: #384
Approved by: cgwalters

9 years agorepo: Fix annotation for ostree_repo_add_gpg_signature_summary
Dan Nicholson [Fri, 8 Jul 2016 20:51:36 +0000 (13:51 -0700)]
repo: Fix annotation for ostree_repo_add_gpg_signature_summary

GI needs to know this is a NULL terminated array of gchar or you'll
segfault using it from a binding.

Closes: #387
Approved by: cgwalters

9 years agoRelease 2016.7
Colin Walters [Fri, 8 Jul 2016 19:29:11 +0000 (15:29 -0400)]
Release 2016.7

Closes: #386
Approved by: jlebon

9 years agofetcher: Remove unused GTask structure member
Colin Walters [Fri, 8 Jul 2016 17:17:33 +0000 (13:17 -0400)]
fetcher: Remove unused GTask structure member

Spotted by mbarnes.

Closes: #383
Approved by: mbarnes

9 years agofetcher: Clear all data for session in session thread
Colin Walters [Fri, 8 Jul 2016 14:15:47 +0000 (10:15 -0400)]
fetcher: Clear all data for session in session thread

Conceptually the session thread owns the session, so let's clear out
everything predictably there, rather than sometimes having it happen
on the main thread.

Also, this moves up clearing the pending/outstanding queues *before*
we unreference the session, since conceptually they need to reference
it as well.

Based on a patch from: Matthew Barnes <mbarnes@redhat.com>

Closes: #383
Approved by: mbarnes

9 years agofetcher: Hold a ref to main context for lifetime of thread
Colin Walters [Fri, 8 Jul 2016 14:01:47 +0000 (10:01 -0400)]
fetcher: Hold a ref to main context for lifetime of thread

I don't think this fixes the bug I was seeing, but it makes me more
comfortable to know we have a strong ref to the main context across
the thread lifetime, and we only unset the default right before
we go away.

If something in `thread_closure_unref()` used
`g_main_context_get_thread_default()` for example it'd be wrong
before.

Closes: #383
Approved by: mbarnes

9 years agotests: Add some test coverage of repeated pulls w/HTTP 500s
Colin Walters [Thu, 7 Jul 2016 21:39:07 +0000 (17:39 -0400)]
tests: Add some test coverage of repeated pulls w/HTTP 500s

Systems like pulp may want to keep retrying in a loop if the server
throws a (hopefully transient) 500, and we need test coverage of
handling these errors versus our existing 404 and 206 coverage.

Closes: #383
Approved by: mbarnes

9 years agotests/libtest.sh: Print non-matching file on failure
Colin Walters [Thu, 7 Jul 2016 21:36:08 +0000 (17:36 -0400)]
tests/libtest.sh: Print non-matching file on failure

We clean up the temporary directory on failure, which means it's hard
to know *why* a regex didn't match.  Print it when we hit an error.

Closes: #383
Approved by: mbarnes

9 years agopull: Free fetch_data by default
Mathnerd314 [Sat, 18 Jun 2016 16:23:12 +0000 (10:23 -0600)]
pull: Free fetch_data by default

This should fix the memory leaks in #352

This is a subset of the changes, the other part is in my pull code rewrite

Closes: #382
Approved by: cgwalters

9 years agostatic-delta-core.c: squash unused var warning
Jonathan Lebon [Mon, 4 Jul 2016 16:49:49 +0000 (12:49 -0400)]
static-delta-core.c: squash unused var warning

Closes: #379
Approved by: cgwalters

9 years agolibostree: Fix build failure with glib 2.42
Bastien Nocera [Mon, 4 Jul 2016 10:31:27 +0000 (10:31 +0000)]
libostree: Fix build failure with glib 2.42

G_DEFINE_AUTOPTR_CLEANUP_FUNC is a new function in GLib 2.44, but
libglnx contains a backported version of it. A few source files were
however using G_DEFINE_AUTOPTR_CLEANUP_FUNC either without including
libglnx.h, or without including it early enough.

This fix is similar to the one in commit d368624.

Closes #376

Closes: #377
Approved by: smcv

9 years agodocs: Add a section on Docker
Colin Walters [Thu, 30 Jun 2016 19:29:28 +0000 (15:29 -0400)]
docs: Add a section on Docker

This could have a lot more obviously, but just laying down my thoughts
as a starting point.

Closes: #374
Approved by: jlebon

9 years agodelta: Add --if-not-exists option
Colin Walters [Fri, 1 Jul 2016 18:39:49 +0000 (14:39 -0400)]
delta: Add --if-not-exists option

I often want to have "idempotent" systems that iterate to a known
state.  If after generating a commit, the system is interrupted, I'd
like the next run to still generate a delta.  But we don't want to
regenerate if one exists, hence this option.

Closes: #375
Approved by: jlebon

9 years agobuild: Override systemd unit directory for distcheck
Dan Nicholson [Mon, 27 Jun 2016 20:06:23 +0000 (13:06 -0700)]
build: Override systemd unit directory for distcheck

distcheck tests that all the files are installed under $prefix. That
doesn't work with the systemd unit directory since the path comes from
pkg-config. Override the setting to be under $prefix in that case.

Closes: #372
Approved by: cgwalters

9 years agotests: Improve check for /proc/cmdline kargs
Dan Nicholson [Fri, 13 May 2016 19:53:01 +0000 (12:53 -0700)]
tests: Improve check for /proc/cmdline kargs

On some systems there may be no root= argument, so the tests for
appending /proc/cmdline arguments will fail. Instead, loop over each of
the arguments in the host's /proc/cmdline and test that they're in the
constructed config file. That will actually test if ostree added all of
the system's /proc/cmdline args correctly. The regex isn't perfect here,
but it's probably good enough for this test.

Closes: #372
Approved by: cgwalters

9 years agotests: Remove extra $CMD_PREFIX from test-auto-summary.sh
Dan Nicholson [Fri, 13 May 2016 18:38:50 +0000 (11:38 -0700)]
tests: Remove extra $CMD_PREFIX from test-auto-summary.sh

$OSTREE already has $CMD_PREFIX in it, so adding it again causes you to
call env twice with LD_PRELOAD.

Closes: #372
Approved by: cgwalters

9 years agobuild: Distribute libglnx and bsdiff Makefile templates
Dan Nicholson [Fri, 13 May 2016 18:01:29 +0000 (11:01 -0700)]
build: Distribute libglnx and bsdiff Makefile templates

In order to re-run autogen.sh from the tarball, the libglnx and bsdiff
Makefile templates need to be provided.

Closes: #372
Approved by: cgwalters

9 years agotests: Ensure mutable deployments from libostreetest
Dan Nicholson [Fri, 13 May 2016 17:22:02 +0000 (10:22 -0700)]
tests: Ensure mutable deployments from libostreetest

When creating sysroots with libostreetest, we don't get the benefit of
the OSTREE_SYSROOT_DEBUG setting in libtest.sh. That means we'll get
immutable deployments that can't be easily cleaned up.

Ensure the environment variable is set before creating new sysroots. It
would be nice to set the debug flags directly, but that's private API
that isn't currently pulled into libostreetest.

Closes: #372
Approved by: cgwalters

9 years agotests: Remove gpg verification files from EXTRA_DIST
Dan Nicholson [Fri, 13 May 2016 13:47:09 +0000 (06:47 -0700)]
tests: Remove gpg verification files from EXTRA_DIST

Follow on from 70a11189. These files are already disted.

Closes: #372
Approved by: cgwalters

9 years agoostree admin switch: fix short summary
Jonathan Lebon [Mon, 27 Jun 2016 17:59:22 +0000 (13:59 -0400)]
ostree admin switch: fix short summary

Closes: #371
Approved by: cgwalters

9 years agocheckout: Add an option to require hardlinks
Colin Walters [Sun, 26 Jun 2016 14:25:03 +0000 (10:25 -0400)]
checkout: Add an option to require hardlinks

I've seen a few people hit this and wonder why checkouts are slow/take
space.  Really, ensuring this happens is the *point* of OSTree.
Physical copies should be a last resort fallback for very unusual
situations (one of those is rpm-ostree checking out the db since
librpm doesn't know how to read from libostree).

Even I hit the fact that `/var` is a mountpoint disallowing hardlinks
with `/ostree` once and was confused.  =)

Add this to the rofiles-fuse test case because it creates a mount
point.

Closes: #368
Approved by: jlebon

9 years agorofiles-fuse: Do allow fchmod/fchown on directories
Colin Walters [Sun, 26 Jun 2016 14:23:56 +0000 (10:23 -0400)]
rofiles-fuse: Do allow fchmod/fchown on directories

The program is called ro*files* and ostree creates physical
copies of directories, so changing them is fine.

I hit this when trying to do a copy checkout onto an rofiles-fuse
mount.

Closes: #368
Approved by: jlebon

9 years agotests: fail the build if symlinking tests/ostree fails
Simon McVittie [Sun, 26 Jun 2016 12:57:13 +0000 (13:57 +0100)]
tests: fail the build if symlinking tests/ostree fails

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #367
Approved by: cgwalters

9 years agotests: use our own generated libtool, not the one in $PATH
Simon McVittie [Sun, 26 Jun 2016 12:56:05 +0000 (13:56 +0100)]
tests: use our own generated libtool, not the one in $PATH

libtoolize creates a version of libtool for the right architecture
in $(top_builddir), which is guaranteed to be present, and is
guaranteed to match what we are compiling (even during
cross-compilation).

Packaging systems sometimes separate /usr/bin/libtool, which is
specific to one architecture, from the libtool development files
such as libtoolize and ltmain.sh, which are architecture-independent.
For example, in Debian, libtool_*_all.deb contains the files necessary
to libtoolize a package and is depended on by the dh-autoreconf package,
but libtool-bin_*_amd64.deb (or whatever architecture) contains
/usr/bin/libtool and is not normally necessary to depend on.

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #367
Approved by: cgwalters

9 years agoentry_pathname_test_helper: these tests need extended attributes
Simon McVittie [Sun, 26 Jun 2016 13:26:37 +0000 (14:26 +0100)]
entry_pathname_test_helper: these tests need extended attributes

Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #366
Approved by: cgwalters

9 years agobuild-sys: Make libostree-1.so depend on the symbol file
Colin Walters [Fri, 24 Jun 2016 13:35:21 +0000 (09:35 -0400)]
build-sys: Make libostree-1.so depend on the symbol file

Otherwise one changing it doesn't cause a symbol to be exported.

Closes: #365
Approved by: jlebon

9 years agotests: Test partial commits for local remotes
Alexander Larsson [Tue, 7 Jun 2016 12:38:21 +0000 (14:38 +0200)]
tests: Test partial commits for local remotes

This was broken before, fixed in the previous commit.

Closes: #324
Approved by: yuqi-zhang

9 years agopull: Write commitpartial files for local imports too
Colin Walters [Tue, 7 Jun 2016 13:50:58 +0000 (09:50 -0400)]
pull: Write commitpartial files for local imports too

Just like HTTP fetches, these can be interrupted, so we need to write
the commitpartial files.

Closes: #324
Approved by: yuqi-zhang

9 years agorefs: resolve conflict between local/remote repos
Yu Qi Zhang [Thu, 23 Jun 2016 16:11:50 +0000 (16:11 +0000)]
refs: resolve conflict between local/remote repos

Add the functionality to use the same name for refs in local and remote
repos. This helps users keep track of local refs of remote origin, much
like local and remote git branches.

Previously, when a local ref is specified, resolve_refspec would fall
back to searching through remote repos if the ref is not found locally.
This function now takes an extra flag to specify whether it should
search through remote repos. Additionally, ostree_repo_resove_rev_ext
was added to call resolve_refspec with fallback_remote being false, so
refs --create would no longer complain when trying to create a local
ref of the same name as a remote one.

Fix remote repo parsing not being handled correctly on refs --create.

Closes: #363
Approved by: jlebon

9 years agopull: Correctly handle repo->parent_repo when applying static deltas
Alexander Larsson [Thu, 23 Jun 2016 09:51:15 +0000 (11:51 +0200)]
pull: Correctly handle repo->parent_repo when applying static deltas

In flatpak i was using a parent repo, and it failed to update
with ENOENT when dispatching an set-read-source opcode, because the
object it referenced was in the parent repo.

This fixes that by making _ostree_repo_read_bare_fd look
at parent_repo.

Closes: #362
Approved by: cgwalters

9 years agorefs: Fix a logic error
Mathnerd314 [Sat, 18 Jun 2016 17:06:31 +0000 (11:06 -0600)]
refs: Fix a logic error

I encountered the Opening remotes/ dir error with some broken pull code, and this fixes it.

Closes: #358
Approved by: cgwalters

9 years agocore: Add OSTREE_OBJECT_TYPE_COMMIT_META
Mathnerd314 [Thu, 16 Jun 2016 05:37:29 +0000 (23:37 -0600)]
core: Add OSTREE_OBJECT_TYPE_COMMIT_META

This is cleaner than the loose_path_with_suffix approach

Closes: #359
Approved by: cgwalters

9 years agoconfigure: Turn on -Wempty-body
Mathnerd314 [Thu, 16 Jun 2016 19:59:06 +0000 (13:59 -0600)]
configure: Turn on -Wempty-body

I spent half an hour debugging an extra semicolon,
and this C "feature" is not used at all in ostree

Closes: #359
Approved by: cgwalters

9 years agocore: Use OSTREE_SHA256_STRING_LEN instead of 64
Mathnerd314 [Sat, 18 Jun 2016 16:31:19 +0000 (10:31 -0600)]
core: Use OSTREE_SHA256_STRING_LEN instead of 64

Closes: #359
Approved by: cgwalters

9 years agocore: Fix wrong return value docs
Krzesimir Nowak [Wed, 22 Jun 2016 09:16:21 +0000 (11:16 +0200)]
core: Fix wrong return value docs

ostree_commit_get_parent() returns a string form of a checksum, not a
binary form.

Closes: #360
Approved by: cgwalters

9 years agorefs: allow overwrite of empty folders
Yu Qi Zhang [Mon, 20 Jun 2016 20:20:58 +0000 (20:20 +0000)]
refs: allow overwrite of empty folders

We noticed that once a ref folder is created, there is no existing
command that can remove it. For example, once "foo/bar" is created,
even if the user deletes foo or all the refs under foo, the folder
will persist.

Now when the user attempts to create a ref "foo" either through commit
or refs --create, if a folder "foo" exists but is empty of refs, the
folder is removed and the new ref "foo" is created.

New unit tests in tests-ref.sh verify this functionality.

Closes: #354
Approved by: cgwalters

9 years agolibglnx porting: Drop uses of gs_file_openat_noatime
Colin Walters [Wed, 15 Jun 2016 01:55:40 +0000 (21:55 -0400)]
libglnx porting: Drop uses of gs_file_openat_noatime

We're not really doing the "noatime" thing anymore.

Closes: #341
Approved by: jlebon